import { reactive } from 'vue'
import { getUserPageList, updateUserStatus, updateUserPassword } from '@/api/system/user'
import { sm4Crypt } from '@/utils/crypt/sm4Utils'

export function useDetail() {
  const status = reactive({
    saving: false,
    loading: false
  })

  const getUserList = async (data: any) => {
    return getUserPageList(data)
  }

  const updateUserStatusById = async (userCode: any, status: any) => {
    return updateUserStatus(userCode, status)
  }

  const updateUserPasswordById = async (userCode: any, password: any) => {
    return updateUserPassword(userCode, sm4Crypt(password))
  }
  return { status, getUserList, updateUserStatusById, updateUserPasswordById }
}
